<?php
    class AdminDthink_Form_ValidateProduct
    {
        public function validProductName($product_name)
        {
            $validator = new Zend_Validate_StringLength(1, 300);
            if($validator->isValid($product_name))
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        
        public function validSortName($sort_name)
        {
            $validator = new Zend_Validate_StringLength(1, 100);
            if($validator->isValid($sort_name))
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        
        public function validProductImage($product_image)
        {
            $validator = new Zend_Validate_NotEmpty();
            if($validator->isValid($product_image))
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        
        public function validProductAdvantages($product_advantages)
        {
            $validator = new Zend_Validate_NotEmpty();
            if($validator->isValid($product_advantages))
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        
        public function validProductConditions($product_conditions)
        {
            $validator = new Zend_Validate_NotEmpty();
            if($validator->isValid($product_conditions))
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        
        public function validProductContent($product_content)
        {
            $validator = new Zend_Validate_NotEmpty();
            if($validator->isValid($product_content))
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        
        public function validProductLink($product_link)
        {
            $validator = new Zend_Validate_NotEmpty();
            if($validator->isValid($product_link))
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        
        public function validOriginalPrice($original_price)
        {
            $validator = new Zend_Validate_StringLength(1, 10);
            if($validator->isValid($original_price))
            {
                $validator = new Zend_Validate_Digits($original_price);
                if($validator->isValid($original_price))
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
            else
            {
                return false;
            }
        }
        
        public function validSalesPrice($sales_price)
        {
            $validator = new Zend_Validate_StringLength(1, 10);
            if($validator->isValid($sales_price))
            {
                $validator = new Zend_Validate_Digits($sales_price);
                if($validator->isValid($sales_price))
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
            else
            {
                return false;
            }
        }
        
        public function validExpiryDay($expiry_day)
        {
            $validator = new Zend_Validate_NotEmpty();
            if($validator->isValid($expiry_day))
            {
                $validator = new Zend_Validate_Date('dd-MM-YYYY');
                if($validator->isValid($expiry_day))
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
            else
            {
                return false;
            }
        }
        
        public function validExpiryTime($expiry_time)
        {
            $validator = new Zend_Validate_NotEmpty();
            if($validator->isValid($expiry_time))
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        
        public function validSearch($keyword)
        {
            $validator = new Zend_Validate_NotEmpty();
            if($validator->isValid($keyword))
            {
                return true;
            }
            else
            {
                return false;
            }
        }
    }
